﻿using MediatR;
using RBAC.LuFang.API.Application.Command.slaughterCommand;
using RBAC.LuFang.Domain;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.slaughterCommandHandler
{
    //更新屠宰下的企业信息
    public class updslaEnterpriseHandler:IRequestHandler<updslaEnterpriseCommand,int>
    {
        private readonly IslaughterService _slaService;

        public updslaEnterpriseHandler(IslaughterService slaService)
        {
            _slaService = slaService;
        }

        public async Task<int> Handle(updslaEnterpriseCommand request, CancellationToken cancellationToken)
        {
            var entModel = new Enterprise() { enterpriseid =request.enterpriseid , livestockfarm =request.livestockfarm , personincharge =request.personincharge , number = request.number , enterprisename =request.enterprisename , provinceID =request.provinceID , theCityID =request.theCityID , countyID =request.countyID , enterpriseDate =request.enterpriseDate , enterpriseDesc =request.enterpriseDesc , enterpriseBan=request.enterpriseBan, enterprisePeople=request.enterprisePeople, goodsId =request.goodsId };
            return await _slaService.updslaEnterprise(entModel);
        }
    }
}
